﻿using Microsoft.Practices.Prism.Commands;
using Microsoft.Practices.Prism.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;

namespace FruitManagerApp
{
    public class DataListViewModel : NotificationObject
    {
        public DataListViewModel()
        {
            EditMode = false;
        }

        #region Property
        public bool EditMode {   get;    set;    }

        private String goPage;
        public String GoPage
        {
            get
            {
                return goPage;
            }
            set
            {
                goPage = value;
                RaisePropertyChanged("GoPage");
            }
        }

        private String pageCount;
        public String PageCount
        {
            get
            {
                return pageCount;
            }
            set
            {
                pageCount = value;
                RaisePropertyChanged("PageCount");
            }
        }

        private String currentPage;
        public String CurrentPage
        {
            get
            {
                return currentPage;
            }
            set
            {
                currentPage = value;
                RaisePropertyChanged("CurrentPage");
            }
        }

        private bool pageUpIsEnabled;
        public bool PageUpIsEnabled
        {
            get
            {
                return pageUpIsEnabled;
            }
            set
            {
                pageUpIsEnabled = value;
                RaisePropertyChanged("PageUpIsEnabled");
            }
        }

        private bool pageDownIsEnabled;
        public bool PageDownIsEnabled
        {
            get
            {
                return pageDownIsEnabled;
            }
            set
            {
                pageDownIsEnabled = value;
                RaisePropertyChanged("PageDownIsEnabled");
            }
        }

        private bool isChecked;
        public bool IsChecked
        {
            get
            {
                return isChecked;
            }
            set
            {
                isChecked = value;
                RaisePropertyChanged("IsChecked");
            }
        }

        private bool addIsEnabled;
        public bool AddIsEnabled
        {
            get
            {
                return addIsEnabled;
            }
            set
            {
                addIsEnabled = value;
                RaisePropertyChanged("AddIsEnabled");
            }
        }

        private bool editIsEnabled;
        public bool EditIsEnabled
        {
            get
            {
                return editIsEnabled;
            }
            set
            {
                editIsEnabled = value;
                RaisePropertyChanged("EditIsEnabled");
            }
        }

        private bool deleteIsEnabled;
        public bool DeleteIsEnabled
        {
            get
            {
                return deleteIsEnabled;
            }
            set
            {
                deleteIsEnabled = value;
                RaisePropertyChanged("DeleteIsEnabled");
            }
        }
        #endregion

        #region Command
        protected DelegateCommand<object> _goCommand;
        public DelegateCommand<object> _GoCommand
        {
            get
            {
                return _goCommand ?? (_goCommand = new DelegateCommand<object>(GoCommand));
            }
        }

        protected virtual void GoCommand(object obj)
        {

        }

        protected DelegateCommand<object> _pageUpCommand;
        public DelegateCommand<object> _PageUpCommand
        {
            get
            {
                return _pageUpCommand ?? (_pageUpCommand = new DelegateCommand<object>(PageUpCommand));
            }
        }

        protected virtual void PageUpCommand(object obj)
        {

        }

        protected DelegateCommand<object> _pageDownCommand;
        public DelegateCommand<object> _PageDownCommand
        {
            get
            {
                return _pageDownCommand ?? (_pageDownCommand = new DelegateCommand<object>(PageDownCommand));
            }
        }

        protected virtual void PageDownCommand(object obj)
        {

        }

        protected DelegateCommand<object> _checkedCommand;
        public DelegateCommand<object> _CheckedCommand
        {
            get
            {
                return _checkedCommand ?? (_checkedCommand = new DelegateCommand<object>(CheckedCommand));
            }
        }

        protected virtual void CheckedCommand(object obj)
        {

        }

        protected DelegateCommand<object> _addCommand;
        public DelegateCommand<object> _AddCommand
        {
            get
            {
                return _addCommand ?? (_addCommand = new DelegateCommand<object>(AddCommand));
            }
        }

        protected virtual void AddCommand(object obj)
        {

        }

        protected DelegateCommand<object> _editCommand;
        public DelegateCommand<object> _EditCommand
        {
            get
            {
                return _editCommand ?? (_editCommand = new DelegateCommand<object>(EditCommand));
            }
        }

        protected virtual void EditCommand(object obj)
        {

        }

        protected DelegateCommand<object> _deleteCommand;
        public DelegateCommand<object> _DeleteCommand
        {
            get
            {
                return _deleteCommand ?? (_deleteCommand = new DelegateCommand<object>(DeleteCommand));
            }
        }

        protected virtual void DeleteCommand(object obj)
        {

        }

        protected DelegateCommand<object> _itemEditClick;
        public DelegateCommand<object> _ItemEditClick
        {
            get
            {
                return _itemEditClick ?? (_itemEditClick = new DelegateCommand<object>(ItemEditClick));
            }
        }

        protected virtual void ItemEditClick(object obj)
        {
            //ProvinceEdit window = new ProvinceEdit();
            //ProvinceEditViewModel viewModel = new ProvinceEditViewModel(window, this, (CProvince)obj);
            //window.DataContext = viewModel;
            //window.Show();
        }
        #endregion
    }
}
